﻿Imports System.IO
Imports System.Xml.Serialization

Public Class DeserializeMockup

    Public Shared Function GetMockup(ByVal _xmlPath As String) As mockup

        Dim _textReader As TextReader = Nothing
        Dim _mockup As mockup

        If Not IO.File.Exists(_xmlPath) Then
            Throw New NotImplementedException
        End If

        Dim serializer As XmlSerializer = New XmlSerializer(GetType(mockup))
        Try
            _textReader = New StreamReader(_xmlPath)
            _mockup = CType(serializer.Deserialize(_textReader), mockup)
        Finally
            If _textReader IsNot Nothing Then _textReader.Close()
        End Try

        Return _mockup

    End Function


End Class